#include "IntroState.h"
#include "../Game.h"
#include <iostream>
using namespace std;
#include "../Bitmap Font/BitmapFont.h"
#include "MainMenuState.h"
#include "GameplayState.h"

CIntroState* CIntroState::GetInstance(void)
{

	static CIntroState s_Instance;
	return &s_Instance;
}

CIntroState::CIntroState() { }

CIntroState::~CIntroState(){ }

void CIntroState::Enter(void)
{
//setup the state
	m_pD3D	= CSGD_Direct3D::GetInstance();
	m_pTM	= CSGD_TextureManager::GetInstance();
	m_pDI	= CSGD_DirectInput::GetInstance();
	m_pXA	= CSGD_XAudio2::GetInstance();
	m_pTM	= CSGD_TextureManager::GetInstance();

	m_pFont = new CBitmapFont();
	m_pFont->Load("resources/XML/DeadlyShadowsFont.xml");


}

void CIntroState::Exit(void)
{
//FONTS
	if (m_pFont != nullptr)
	{
		delete m_pFont;
		m_pFont = nullptr;
	}
}

void CIntroState::Update(float fElapsedTime) { }

void CIntroState::Render(void)
{
	m_pFont->Print("Intro Screen", 0,0,4.0f,D3DCOLOR_XRGB(255,0,0));
	m_pFont->Print("Test Screen", 100,100,3.0f,D3DCOLOR_XRGB(255,0,0));

}

bool CIntroState::Input(void)
{
	int key = m_pDI->GetDIKCode();
	if (m_pDI->KeyPressed(key))
	{
		CGame::GetInstance()->AddState(CMainMenuState::GetInstance());
		CGame::GetInstance()->RemoveState(this);
	}
	return true;
}